package com.vv.boot3demo.controller;

import com.vv.boot3demo.http.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ProblemDetail;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author kw
 * @program boot3-demo
 * @description 用户控制器
 * @create 2025 - 05 - 07 22:19
 **/
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 获取用户名
     *
     * @return {@link String}
     */
    @RequestMapping("getUserName")
    public ProblemDetail getUserName() {
        List<String> userName = userService.getUserName();
        return ProblemDetail.forStatusAndDetail(HttpStatusCode.valueOf(200), userName.toString());
    }
}
